#pragma once
#include<iostream>
#include<string>
#include"inetAdder.hpp"
//封装fd，保证给每个fd一个缓冲区
class tcpserver;
class Connection
{
    public:
    Connection()
    {}
    virtual void Recv() = 0;
    virtual void Send() = 0;
    virtual void Excepter() = 0;
    void Setevents(const uint32_t &events)
    {
        _events = events;
    }
    uint32_t Getevents()
    {
        return _events;
    }
    void SetFD(int sockfd)
    {
        _sockfd = sockfd;
    }
    int GetFD()
    {
        return _sockfd;
    }
    ~Connection()
    {}
private:
int _sockfd;
std::string _inbuffer;//伪装一下缓冲区
std::string _outbuffer;

//回指指针
tcpserver *owner;

//是哪个客户端发起的请求
inetaddr _addr;

//关心的事件
uint32_t _events;
};